import copy


class CPU:
    pass


class Disk:
    pass


class Computer:
    def __init__(self, cpu, disk):
        self.cpu = cpu
        self.disk = disk

    def __str__(self):
        return "当前对象id:{0},cpu的id:{1},disk的id{2}".format(id(self), id(self.cpu), id(self.disk))


# 1、变量赋值
cpu1 = CPU()
cpu2 = cpu1
print(cpu1, cpu2)

print('--------浅拷贝-------------')
# 2、类的浅拷贝
disk = Disk()
computer = Computer(cpu1, disk)
print(computer)

# 浅拷贝
computer2 = copy.copy(computer)
print(computer2)

print('--------深拷贝--------------------------')
computer3 = copy.deepcopy(computer)
print(computer3)
